package com.weikuang.fareast.adapter;

import android.view.View;
import android.widget.LinearLayout;

import com.weikuang.fareast.R;
import com.weikuang.fareast.bean.Count1Bean;

import cn.dlc.commonlibrary.ui.adapter.BaseRecyclerAdapter;
import cn.dlc.commonlibrary.utils.TimeFormatsUtil;


/**
 * 统计列表
 */
public class AddListAdapter extends BaseRecyclerAdapter<Count1Bean.DataBean> {
    private OnRecyclerViewItemClickListener mOnItemClickListener;
    @Override
    public int getItemLayoutId(int viewType) {
        return R.layout.item_add_list;
    }

    public AddListAdapter() {

    }

    @Override
    public void onBindViewHolder(CommonHolder holder, int position) {
        Count1Bean.DataBean bean = getItem(position);
        holder.getText(R.id.hospital).setText(bean.hotel);
        holder.getText(R.id.offic).setText(bean.office);
        holder.getText(R.id.order).setText(bean.orderno);
        holder.getText(R.id.nums).setText(bean.amount);
        holder.getText(R.id.nums_check).setText(bean.checkNums);
        holder.getText(R.id.time).setText(TimeFormatsUtil.setTime3(bean.ctime));
        LinearLayout btn_sure = holder.getView(R.id.btn_sure);
        btn_sure.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (mOnItemClickListener != null){
                    mOnItemClickListener.onItemClick(view,bean,position);
                }
            }
        });


    }
    public  interface OnRecyclerViewItemClickListener {
        void onItemClick(View view, Count1Bean.DataBean data, int position);
    }

    public void setOnItemClickListener(OnRecyclerViewItemClickListener listener) {
        this.mOnItemClickListener = listener;
    }
}
